package com.zkhz.base.common.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 分页查询基础条件
 * @author liaozhiyong
 * @param <T> 分页查询的实体对象类型
 */
@Data
public abstract class PageDTO<T> implements Serializable {
    /**
     * 默认的分页大小
     */
    private static final int DEFAULT_PAGE_SIZE = 10;

    @ApiModelProperty(value = "页码", example = "1")
    private long pageNum;

    @ApiModelProperty(value = "每页记录", example = "10")
    private long pageSize = DEFAULT_PAGE_SIZE;

    public Page<T> page() {
        return new Page<>(this.pageNum, this.pageSize);
    }
}
